Longest Consecutive Sequence Leetcode Javascript